import { h, App } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import Banner from './components/Banner.vue'

export default {
  extends: DefaultTheme,
  Layout() {
    return h(DefaultTheme.Layout, null, {
      'home-hero-before': () => h(Banner)
    })
  },
  enhanceApp({ app, router, siteData }) {
    router.onBeforeRouteChange = (to) => {
        console.log('路由将改变为: ', to);
        if (typeof _hmt !== 'undefined') {
            _hmt.push(['_trackPageview', to]);
        }
      };
  }
} satisfies Theme